home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / g_man / cat3 / ftn / qgetfd.z / qgetfd
Encoding:
Text File  |  2002-10-03  |  4.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4. qqqqggggeeeettttffffdddd((((3333GGGG))))                                                          qqqqggggeeeettttffffdddd((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      qqqqggggeeeettttffffdddd - get the read file descriptor associated with the event queue
  10.  
  11. FFFFOOOORRRRTTTTRRRRAAAANNNN 77777777 SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  12.      iiiinnnntttteeeeggggeeeerrrr****4444 ffffuuuunnnnccccttttiiiioooonnnn qqqqggggeeeettttffffdddd
  13.  
  14. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  15.      _n_o_n_e
  16.  
  17. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  18.      The returned function value is the read file descriptor associated with
  19.      the event queue.  If there is an error, the returned value is a negative
  20.      integer whose absolute value is an error value defined in <_e_r_r_n_o._h>.
  21.  
  22. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.      qqqqggggeeeettttffffdddd returns the read file descriptor associated with the event queue.
  24.      The file descriptor can then be used with the _s_e_l_e_c_t(2) system call.
  25.  
  26. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  27.      The following example (presented in pseudo-code; not to be typed
  28.      verbatim) is suggested for reading events off of the GL queue using
  29.      _s_e_l_e_c_t(2):
  30.  
  31.           FD_ZERO(&readfds);
  32.           if ((glfd = qgetfd()) < 0) {
  33.               printf("bad file descriptor %d0, glfd);
  34.               exit(-1);
  35.           }
  36.           for (;;) {
  37.               while (qtest()) {
  38.                   .
  39.                   .
  40.                   blkqread()
  41.                   .
  42.                   .
  43.               }
  44.               /* Make sure all GL rendering which may be acting as a prompt or
  45.                * cue for the user has completed before checking for a response
  46.                * from the user.
  47.                */
  48.               gflush();
  49.               FD_SET(glfd,&readfds);       /* select with qgetfd descriptor   */
  50.               FD_SET(,);                   /* select with others descriptors  */
  51.               .
  52.               nfound = select (,&readfds,,,);
  53.               if (FD_ISSET(glfd,&readfds)) /* process queue events            */
  54.                continue;
  55.               if (FD_ISSET(,)) {           /* process other then queue events */
  56.                .
  57.                .
  58.               }
  59.           }
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. qqqqggggeeeettttffffdddd((((3333GGGG))))                                                          qqqqggggeeeettttffffdddd((((3333GGGG))))
  71.  
  72.  
  73.  
  74.      The example provides two important pieces of advice. First, use _b_l_k_q_r_e_a_d
  75.      instead of multiple _q_r_e_a_d_s because it is more efficient.  Second, to
  76.      ensure the proper behavior of _s_e_l_e_c_t, call _q_t_e_s_t before and after you
  77.      call _s_e_l_e_c_t. When _s_e_l_e_c_t indicates data is available on the file
  78.      descriptor, there may not be GL event data to read.  Similarly, there is
  79.      a condition where _s_e_l_e_c_t would block, but data is available. The use of
  80.      _q_t_e_s_t before and after _s_e_l_e_c_t guards against this.
  81.  
  82.  
  83. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  84.      qread, gflush, select(2) (in the _P_r_o_g_r_a_m_m_e_r'_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l)
  85.  
  86. NNNNOOOOTTTTEEEESSSS
  87.      This routine is available only in immediate mode.
  88.  
  89. BBBBUUUUGGGGSSSS
  90.      The file descriptor returned by qqqqggggeeeettttffffdddd will not be detected as ready for
  91.      reading by the system call _s_e_l_e_c_t(2) when TIMER events are inserted into
  92.      the queue.  Instead, one should use the timeout feature of _s_e_l_e_c_t(2) to
  93.      achieve the same functionality.
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.